package com.aierkeji.call.cms.entity;

import static javax.persistence.ConstraintMode.PROVIDER_DEFAULT;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.aierkeji.call.cms.entity.snap.AkjCallUserSnap;

/**
 * 企业
 * 
 * @author 陈宇强
 *
 */
@Entity
@Table(name = "Akj_call_enterprise")
public class AkjCallEnterprise {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", length = 32)
	private Long id;
	@Column(name = "name", length = 60)
	private String name;

	@ManyToOne(targetEntity = AkjCallUserSnap.class, cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
	@JoinColumn(name = "created_by", nullable = true,foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
	@NotFound(action = NotFoundAction.IGNORE)
	private AkjCallUserSnap createdBy;

	@Column(columnDefinition = "datetime")
	private Date updatedAt;

	@Column(columnDefinition = "datetime")
	private Date createdAt;

	@ManyToOne(targetEntity = AkjCallUserSnap.class, cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
	@JoinColumn(name = "updated_by", nullable = true,foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
	@NotFound(action = NotFoundAction.IGNORE)
	private AkjCallUserSnap updatedBy;

	@Column(name = "is_delete", nullable = false)
	private boolean isDelete = false;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public AkjCallUserSnap getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(AkjCallUserSnap createdBy) {
		this.createdBy = createdBy;
	}

	public Date getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public AkjCallUserSnap getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(AkjCallUserSnap updatedBy) {
		this.updatedBy = updatedBy;
	}

	public boolean isDelete() {
		return isDelete;
	}

	public void setDelete(boolean isDelete) {
		this.isDelete = isDelete;
	}

}
